package com.xqzgj.bill.service.impl;

import java.util.List;
import com.xqzgj.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xqzgj.bill.mapper.ExpenseMapper;
import com.xqzgj.bill.domain.Expense;
import com.xqzgj.bill.service.IExpenseService;

/**
 * 支出记录Service业务层处理
 * 
 * @author zhoujiam
 * @date 2025-03-30
 */
@Service
public class ExpenseServiceImpl implements IExpenseService 
{
    @Autowired
    private ExpenseMapper expenseMapper;

    /**
     * 查询支出记录
     * 
     * @param expenseId 支出记录主键
     * @return 支出记录
     */
    @Override
    public Expense selectExpenseByExpenseId(Long expenseId)
    {
        return expenseMapper.selectExpenseByExpenseId(expenseId);
    }

    /**
     * 查询支出记录列表
     * 
     * @param expense 支出记录
     * @return 支出记录
     */
    @Override
    public List<Expense> selectExpenseList(Expense expense)
    {
        return expenseMapper.selectExpenseList(expense);
    }

    /**
     * 新增支出记录
     * 
     * @param expense 支出记录
     * @return 结果
     */
    @Override
    public int insertExpense(Expense expense)
    {
        expense.setCreateTime(DateUtils.getNowDate());
        return expenseMapper.insertExpense(expense);
    }

    /**
     * 修改支出记录
     * 
     * @param expense 支出记录
     * @return 结果
     */
    @Override
    public int updateExpense(Expense expense)
    {
        expense.setUpdateTime(DateUtils.getNowDate());
        return expenseMapper.updateExpense(expense);
    }

    /**
     * 批量删除支出记录
     * 
     * @param expenseIds 需要删除的支出记录主键
     * @return 结果
     */
    @Override
    public int deleteExpenseByExpenseIds(Long[] expenseIds)
    {
        return expenseMapper.deleteExpenseByExpenseIds(expenseIds);
    }

    /**
     * 删除支出记录信息
     * 
     * @param expenseId 支出记录主键
     * @return 结果
     */
    @Override
    public int deleteExpenseByExpenseId(Long expenseId)
    {
        return expenseMapper.deleteExpenseByExpenseId(expenseId);
    }
}
